﻿@model NOSDC.Models.EventsViewModel

@if (Model.NoEvent)
    {
        <div id="event">
            <div class="newsPosting">
                <div>
                    <div class="leftIcon">
                    </div>
                    <div class="titleWrapper">
                        <div class="newsTitle">@Model.Event.Title</div>
                        @if (!String.IsNullOrEmpty(Model.Event.Logo))
                        {
                            <div class="newsDate"><img src="@Url.Content("~/Images/Logos/" + @Model.Event.Logo)" alt="@Model.Event.Logo" /></div>
                        }
                    </div>
                </div>
                <div class="rightIcon">
                </div>
            </div>
            <div style="padding:10px;">
                <div class="eventPadding"><span class="eventField">About the event</span></div>
                <div class="eventDescription">@Html.Raw(@Model.Event.Description)</div>

                @if (Model.HasSpeaker)
                {
                    <div>
                        <div class="eventPadding"><span class="eventField">Speaker</span>: @Model.Event.Speaker.ToString()</div>
                        <div><span class="eventField">Bio</span>: @Model.Event.Speaker.Bio</div>
                    </div>
                }
                <br />
        
                <div class="eventPadding"><span class="eventField">When</span>: @Model.Event.StartDate</div>
                <div class="eventPadding"><span class="eventField">Where</span>: @Model.Event.Location</div>
            </div>
            @if (Model.Event.StartDate > DateTime.Now)
            {
            <div id="eventSignupMain">
            
                @if (Membership.GetUser() != null)
                {
                    if (Model.IsAttendingEvent)
                    {
                        <div id="attending" style="height:25px;line-height:23px;"><img style="vertical-align:middle;" src="../../../Images/information.png" alt="" /><span><strong>You are attending this event!</strong></span></div>
                    }
                    else
                    {
                        using (Ajax.BeginForm("Attend", "Events", new { eventId = Model.Event.EventID, main = true }, new AjaxOptions { UpdateTargetId = "event", InsertionMode = InsertionMode.Replace, OnSuccess = "signupSuccess" }))
                        {
                            <input type="image" src="../../../Images/sign_o.png" alt="SignUp" />
                        }
                    }
                }
                else
                {
                    <strong>You must login to attend this event!</strong>
                }
           
            </div> 
            }
            <br />
            <fieldset id="attendees" class="collapsed eventAttendees" >
                  <div>
                        <div class="commentHeader">View Attendees</div>
                        <div class="commentTotal"><img id="attendeeButton" src="@Url.Content("~/Images/expand.png")" alt="" /></div>
                  </div>
          
          
            </fieldset>
            <div class="attendees">
                @for (var i = 0; i < Model.Event.EventAttendees.Count(); i++)
                {
                    <div>
                        @if (i % 2 == 1)
                        {
                            <div style="float:left; width:315px; padding:5px;">@Membership.GetUser(Model.Event.EventAttendees[i].UserID).UserName</div>
                        }
                        else
                        {
                            <div style="float:right; width:300px;padding:5px;">
                                <div style="float:left;">@Membership.GetUser(Model.Event.EventAttendees[i].UserID).UserName</div>
                            </div>}
                    </div>
                }
            </div>
        </div>
    }
else
{
        <div>There are no new events</div>
}
    <br />

   